package 题集.力扣.动态规划;

/**
 * @author 张从龙
 * <p>
 * dp[n] = Math.max(dp[n-1], dp[n-2]+2)
 *
 * @version [1.0.0, 2022/8/27]
 */
public class T70爬楼梯 {
    public int climbStairs(int n){
        int[] dp = new int[n];

        if(n==1){
            return 1;
        }else if(n==2){
            return 2;
        }
        dp[n-1] = climbStairs(n-1);
        dp[n-2] = climbStairs(n-2);
        dp[n] = Math.max(dp[n-1], dp[n-2]+2);
        return dp[n];
    }

    public static void main(String[] args) {

    }
}
